home *** CD-ROM | disk | FTP | other *** search
-
-
-
- cccchhhhmmmmoooodddd((((1111)))) cccchhhhmmmmoooodddd((((1111))))
-
-
-
- NNNNAAAAMMMMEEEE
- chmod - change the permissions mode of a file or directory
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- cccchhhhmmmmoooodddd [-R] mode file ...
- cccchhhhmmmmoooodddd [-R] [ugoa]{+|-|=}[rwxXstl] file ...
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The permissions of the named _f_i_l_e_s or _d_i_r_e_c_t_o_r_i_e_s are changed according
- to mode, which may be symbolic or absolute. Absolute changes to
- permissions are stated using octal numbers:
-
- cccchhhhmmmmoooodddd _n_n_n _f_i_l_e(_s)
-
- where _n is a number from 0 to 7. Symbolic changes are stated using
- mnemonic characters:
-
- cccchhhhmmmmoooodddd _a _o_p_e_r_a_t_o_r _b _f_i_l_e(_s)
-
- where _a is one or more characters corresponding to uuuusssseeeerrrr, ggggrrrroooouuuupppp, or ooootttthhhheeeerrrr;
- where _o_p_e_r_a_t_o_r is ++++, ----, and ====, signifying assignment of permissions; and
- where _b is one or more characters corresponding to type of permission.
-
- An absolute mode is given as an octal number constructed from the OR of
- the following modes:
-
- 04000 set user ID on execution
- 020#0 set group ID on execution if # is 7777, 5555, 3333, or 1111
- enable mandatory locking if # is 6666, 4444, 2222, or 0000
- This applies only to regular files. See discussion below
- for effect on directories.
- 01000 sticky bit (see discussion below)
- 0400 read by owner
- 0200 write by owner
- 0100 execute (search in directory) by owner
- 0070 read, write, execute (search) by group
- 0007 read, write, execute (search) by others
-
- Symbolic changes are stated using letters that correspond both to access
- classes and to the individual permissions themselves. Permissions to a
- file may vary depending on your user identification number (UID) or group
- identification number (GID). Permissions are described in three
- sequences each having three characters:
-
- User Group Other
-
- rwx rwx rwx
-
- This example (meaning that uuuuser, ggggroup, and oooothers all have rrrreading,
- wwwwriting, and exxxxecution permission to a given file) demonstrates two
- categories for granting permissions: the access class and the
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- cccchhhhmmmmoooodddd((((1111)))) cccchhhhmmmmoooodddd((((1111))))
-
-
-
- permissions themselves.
-
- Thus, to change the mode of a file's (or directory's) permissions using
- _c_h_m_o_d's symbolic method, use the following syntax for mode:
-
- [ _w_h_o ] _o_p_e_r_a_t_o_r [ _p_e_r_m_i_s_s_i_o_n(_s) ], ...
-
- A command line using the symbolic method would appear as follows:
-
- cccchhhhmmmmoooodddd gggg++++rrrrwwww _f_i_l_e(_s)
-
- This command would make _f_i_l_e readable and writable by the group.
-
- The _w_h_o part can be stated as one or more of the following letters:
-
- uuuu uuuuser's permissions
- gggg ggggroup's permissions
- oooo oooothers permissions
-
- The letter aaaa (aaaall) is equivalent to uuuuggggoooo.
-
- If _w_h_o is omitted, the operation applies to all permissions except those
- set in the user's umask.
-
- _O_p_e_r_a_t_o_r can be ++++ to add _p_e_r_m_i_s_s_i_o_n to the file's mode, ---- to take away
- _p_e_r_m_i_s_s_i_o_n, or ==== to assign _p_e_r_m_i_s_s_i_o_n absolutely. (Unlike other symbolic
- operations, ==== has an absolute effect in that it resets all other bits.)
- Omitting _p_e_r_m_i_s_s_i_o_n is only useful with ==== to take away all permissions.
-
- _P_e_r_m_i_s_s_i_o_n is any compatible combination of the following letters:
- rrrr rrrreading permission
- wwww wwwwriting permission
- xxxx exxxxecution permission
- XXXX execution permission (see below)
- ssss user or group sssset-ID is turned on
- tttt sticky bit is turned on
- llll mandatory llllocking will occur during access
-
- When XXXX appears in _p_e_r_m_i_s_s_i_o_n it is identical to xxxx if the target file is a
- directory, or if the file is of any other type but already has at least
- one execution bit (user, group, or other) set. In all other cases, XXXX is
- silently ignored.
-
- Multiple symbolic modes separated by commas may be given, though no
- spaces may intervene between these modes. Operations are performed in
- the order given. Multiple symbolic letters following a single operator
- cause the corresponding operations to be performed simultaneously. The
- letter ssss is only meaningful with uuuu or gggg, and tttt only works with uuuu.
-
- Mandatory file and record locking (llll) refers to a file's ability to have
- its reading or writing permissions locked while a program is accessing
- that file. It is not possible to permit group execution and enable a
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- cccchhhhmmmmoooodddd((((1111)))) cccchhhhmmmmoooodddd((((1111))))
-
-
-
- file to be locked on execution at the same time. In addition, it is not
- possible to turn on the set-group-ID and enable a file to be locked on
- execution at the same time. The following examples,
-
- cccchhhhmmmmoooodddd gggg++++xxxx,,,,++++llll _f_i_l_e(_s)
-
- cccchhhhmmmmoooodddd gggg++++ssss,,,,++++llll _f_i_l_e(_s)
-
- are, therefore, illegal usages and will elicit error messages.
-
- Only the owner of a file or directory (or the superuser) may change a
- file's mode. In order to turn on a file's set-group-ID, your own group
- ID must correspond to the file's, and group execution must be set.
-
- If a directory is writable and the sticky bit, (tttt), is set on the
- directory, a process may remove or rename files within that directory
- only if one or more of the following is true (see _uuuu_nnnn_llll_iiii_nnnn_kkkk(2) and
- _rrrr_eeee_nnnn_aaaa_mmmm_eeee(2)):
-
- the effective user ID of the process is the same as that of the
- owner ID of the file
-
- the effective user ID of the process is the same as that of the
- owner ID of the directory
-
- the process is a superuser.
-
- Note that the group id of the process and file are not taken into account
- by the rules above. A process will only be able to remove a file in a
- sticky directory based upon its effective user ID, not its group ID.
-
- In releases of IRIX before 6.2, a process could also remove or rename
- files within a directory with the sticky bit set if the process had write
- permission for the file. This has been changed in accordance with the
- X/Open XPG4.2 standard, but the old behavior can be enabled via the
- xpg4_sticky_dir kernel tunable variable.
-
- If the sticky bit, (tttt), is set on a file that is a dynamic loader for an
- _E_L_F executable, then when the executable is _e_x_e_ced the old process's read
- only address spaces will be made available to the dynamic loader in the
- new process. This can improve program start up time considerably.
-
- The setting of the sticky bit on any other file has no effect.
-
- If the set-group-ID flag is set on a directory, then files created in
- that directory will have their group ID set to the group ID of the
- directory, otherwise the group ID of the file is set to the effective
- group ID of the creating process (see _c_h_m_o_d(2)]. The set-group-ID flag
- can only be set on a directory by using the symbolic mode: that is,
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-
-
-
- cccchhhhmmmmoooodddd((((1111)))) cccchhhhmmmmoooodddd((((1111))))
-
-
-
- chmod g+s _d_i_r_e_c_t_o_r_y
-
- _m_o_u_n_t(1) provides an alternate way to set this behavior for an entire
- filesystem (see _m_o_u_n_t(1) and _f_s_t_a_b(4)].
-
- The ----RRRR option recursively descends through directory arguments, setting
- the mode for each file as described above. If a symbolic link is
- encountered whose target is a directory, the permission of the directory
- is changed. That directory's contents are _n_o_t recursively traversed.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- chmod a-x _f_i_l_e
-
- chmod 444 _f_i_l_e
-
- The first examples deny execution permission to all. The absolute
- (octal) example permits only reading permissions.
-
- chmod go+rw _f_i_l_e
-
- chmod 066 _f_i_l_e
-
- These examples make a file readable and writable by the group and others.
-
- chmod +l _f_i_l_e
-
- This causes a file to be locked during access.
-
- chmod =rwx,g+s _f_i_l_e
-
- chmod 2777 _f_i_l_e
-
- These last two examples enable all to read, write, and execute the file;
- and they turn on the set group-ID.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- ls(1), mount(1), umask(1), chmod(2), unlink(2).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 4444
-
-
-
-